{extend name="template/base" /}
{block name="content"}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$vo.id ?? ''}">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>项目配图：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <div title="点击选取图片">
                    <img {notempty name="vo.kind_img"}
                         src="{:getimg($vo.kind_img)}"
                         {/notempty}
                    style="width:100px;height: 100px;" class="getimg thumbnail" id="getimg">
                </div>
                <input type="file" style="display: none;" name="files[]" data-url="{:url('Uploads/uploads')}" id="fileupload" value="点击修改" >
                <input type="hidden" placeholder="图片路径" id="imgsrc" name="kind_img" value="{$vo.kind_img ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>


        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>项目名称：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="项目名称" name="kind_name" value="{$vo.kind_name ?? ''}"  datatype="*" nullmsg="请输入项目名称">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>初赛时间：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" id="test1" placeholder="时间" name="kind_timeone" value="{$vo.kind_timeone ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>初赛地点：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="初赛地点" name="kind_locone" value="{$vo.kind_locone ?? ''}"  datatype="*" nullmsg="请输入初赛地点">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>决赛时间：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" id="test2" placeholder="时间" name="kind_timetwo" value="{$vo.kind_timetwo ?? ''}" >
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>决赛地点：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="决赛地点" name="kind_loctwo" value="{$vo.kind_loctwo ?? ''}"  datatype="*" nullmsg="请输入决赛地点">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <link rel="stylesheet" href="__LIB__/layui/css/layui.css">
        <script type="text/javascript" src="__LIB__/layui/layui.js"></script>
        <script>
            layui.use('laydate', function(){
                var laydate = layui.laydate;
                //执行一个laydate实例
                laydate.render({
                    elem: '#test1'
                    ,type: 'datetime'
                });
                laydate.render({
                    elem: '#test2'
                    ,type: 'datetime'
                });
            });
        </script>

        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>项目规则：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <textarea class="col-xs-12 col-sm-12" style="height: 200px;" name="kind_rule" datatype="*" nullmsg="请输入项目规则" >
                    {$vo.kind_rule ?? ''}
                </textarea>
                <!--<input type="text" class="input-text" placeholder="项目规则" name="kind_rule" value="{$vo.kind_rule ?? ''}"  datatype="*" nullmsg="请输入项目规则">-->
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script>
    $(function () {


        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form").Validform({
            tiptype: 2,
            ajaxPost: true,
            showAllError: true,
            callback: function (ret){
                ajax_progress(ret);
            }
        });


        /**
         *  图片上传预览
         * {:url('Uploads/uploads')}
         */
        $("#fileupload").fileupload({
            dataType:'json',
            done:function(e,data){
                $('.getimg')[0].src=data.result.data[0];
//            给图片路径赋值
                $("#imgsrc").val(data.result.data['name']);
            }
        });
        $("#getimg").click(function () {
            $("#fileupload").click();
        });


    })


</script>
{/block}
